# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=psmisc
pkgver=23.2
pkgrel=1
pkgdesc="Miscellaneous procfs tools"
arch=('i686' 'x86_64')
url="https://psmisc.sourceforge.io/"
license=('GPL')
groups=('sys-utils')
depends=('msys2-runtime' 'gcc-libs' 'ncurses' 'libiconv' 'libintl')
makedepends=('gcc' 'ncurses-devel' 'libiconv-devel' 'gettext-devel')
source=(${pkgname}-${pkgver}.tar.gz::https://gitlab.com/psmisc/psmisc/-/archive/v${pkgver}/${pkgname}-v${pkgver}.tar.gz)
sha256sums=('03533fc0c19c16073d2ebbcbb2ad4e1d870467aa1b91663f57c4a1437ff78e9f')

prepare() {
  cd ${pkgname}-v${pkgver}
  echo ${pkgver} > .tarball-version
  ./autogen.sh
}

build() {
  cd ${pkgname}-v${pkgver}
  ./configure \
    --prefix=/usr \
    --without-libiconv-prefix \
    --without-libintl-prefix \
    --disable-harden-flags \
    CPPFLAGS="${CPPFLAGS} -I/usr/include/ncursesw"
  make
}

package() {
  cd ${pkgname}-v${pkgver}
  make DESTDIR=${pkgdir} install
}
